//
//  OrderButton.swift
//  Box
//
//  Created by mn on 2025/3/30.
//
import UIKit
class OrderButton: UIButton {
    private let iconImageView: UIImageView = {
        let imageView = UIImageView()
        imageView.contentMode = .scaleAspectFit
        return imageView
    }()
    
    private let titleLabelView: UILabel = {
        let label = UILabel()
        label.font = UIFont.systemFont(ofSize: 10)
        label.textAlignment = .center
        label.textColor = UIColor.fromHex("#E1E1E1")
        return label
    }()
    
    init(title: String, imageName: String) {
        super.init(frame: .zero)
        
        titleLabelView.text = title
        iconImageView.image = UIImage(named: imageName)
        
        addSubview(iconImageView)
        addSubview(titleLabelView)
        
        iconImageView.snp.makeConstraints { make in
            make.top.left.right.equalToSuperview()
            make.size.equalTo(CGSize(width: 47, height: 47))
        }
        
        titleLabelView.snp.makeConstraints { make in
            make.top.equalTo(iconImageView.snp.bottom).offset(11.5)
            make.centerX.bottom.equalToSuperview()
            make.bottom.lessThanOrEqualToSuperview()
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
